package main

import (
	"fmt"
	"net/http"
	"time"
)

const port = ":8080"

func HelloHandler(w http.ResponseWriter, r *http.Request) {
	w.Write([]byte("Hello, World!"))
}

func CurrentTimeHandler(w http.ResponseWriter, r *http.Request) {
	curTime := time.Now().Format(time.Kitchen)
	w.Write([]byte(fmt.Sprintf("the current time is %v", curTime)))
}

func main() {

	mux := http.NewServeMux()

	mux.HandleFunc("/hello", HelloHandler)

	mux.HandleFunc("/time", CurrentTimeHandler)

	http.ListenAndServe(port, mux)
}
